package com.qiangshi.tasksProgress.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.qiangshi.common.annotation.Log;
import com.qiangshi.common.core.controller.BaseController;
import com.qiangshi.common.core.domain.AjaxResult;
import com.qiangshi.common.enums.BusinessType;
import com.qiangshi.tasksProgress.domain.QsTasksProgress;
import com.qiangshi.tasksProgress.service.IQsTasksProgressService;
import com.qiangshi.common.utils.poi.ExcelUtil;
import com.qiangshi.common.core.page.TableDataInfo;

/**
 * 进度提报Controller
 * 
 * @author qiangshi
 * @date 2022-02-12
 */
@RestController
@RequestMapping("/tasksProgress/tasksProgress")
public class QsTasksProgressController extends BaseController
{
    @Autowired
    private IQsTasksProgressService qsTasksProgressService;

    /**
     * 查询进度提报列表
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:list')")
    @GetMapping("/list")
    public TableDataInfo list(QsTasksProgress qsTasksProgress)
    {
        startPage();
        List<QsTasksProgress> list = qsTasksProgressService.selectQsTasksProgressList(qsTasksProgress);
        return getDataTable(list);
    }

    /**
     * 导出进度提报列表
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:export')")
    @Log(title = "进度提报", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(QsTasksProgress qsTasksProgress)
    {
        List<QsTasksProgress> list = qsTasksProgressService.selectQsTasksProgressList(qsTasksProgress);
        ExcelUtil<QsTasksProgress> util = new ExcelUtil<QsTasksProgress>(QsTasksProgress.class);
        return util.exportExcel(list, "tasksProgress");
    }

    /**
     * 获取进度提报详细信息
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(qsTasksProgressService.selectQsTasksProgressById(id));
    }

    /**
     * 新增进度提报
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:add')")
    @Log(title = "进度提报", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody QsTasksProgress qsTasksProgress)
    {
        return toAjax(qsTasksProgressService.insertQsTasksProgress(qsTasksProgress));
    }

    /**
     * 修改进度提报
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:edit')")
    @Log(title = "进度提报", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody QsTasksProgress qsTasksProgress)
    {
        return toAjax(qsTasksProgressService.updateQsTasksProgress(qsTasksProgress));
    }

    /**
     * 删除进度提报
     */
    @PreAuthorize("@ss.hasPermi('tasksProgress:tasksProgress:remove')")
    @Log(title = "进度提报", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(qsTasksProgressService.deleteQsTasksProgressByIds(ids));
    }
}
